<style>
    #category-select select {
        padding-right: 20px;
    }

    .location {margin:10px 0;border: 1px solid #cccccc;padding: 0 10px;}
    .addr-box{
        display: flex;
        padding: 15px;
        border: 1px solid #E1E1E1;
        font-size: 16px;
        color: #333;
        font-weight: normal;
    }
    .addr-box input{
        margin: 0;
    }
    .addr-box .addr{
        margin-left: 15px;
        flex: 1;
    }
</style>
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Company_id')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-company_id" data-rule="required" data-source="xilujob/job/select_company" data-field="company_name" class="form-control selectpage" name="row[publisher_id]" type="text" value="">
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">发布区域:</label>
        <div class="col-xs-12 col-sm-4">
            <select id="c-city_id" title="请选择" data-rule="required" class="form-control selectpicker" name="row[city_id]">
                {foreach name="siteCities" item="vo" key="index"}
                <option value="{$vo.city_id}" >{$vo.city_name}</option>
                {/foreach}
            </select>
        </div>
        <div class="col-xs-12 col-sm-4">
            <select id="c-district_id" data-value="" title="请选择" data-rule="required" class="form-control selectpicker" name="row[district_id]">
            </select>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">类型:</label>
        <div class="col-xs-12 col-sm-8">
            {:build_radios('row[type]',[2=>'兼职',1=>'全职'], '')}
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Job_name')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-job_name" data-rule="required" class="form-control" name="row[job_name]" type="text" value="">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">招聘人数:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-num" data-rule="required;integer(+)" class="form-control" name="row[num]" type="number" value="">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Job_category_id')}:</label>
        <div class="col-xs-12 col-sm-8">
            <!--<input id="c-job_category_id" data-rule="required" data-source="job/category/index" class="form-control selectpage" name="row[job_category_id]" type="text" value="">-->
            <div id="category-select" class="form-inline" data-toggle="cxselect" data-selects="category1,category2,category3">
                <select class="category1 form-control" data-rule="required" data-target="#category_error" data-query-name="row[job_category_id]" data-url="xilujob/job_category/job_category">
                    <option value="{$category_ids[0]}" selected></option>
                </select>
                <select class="category2 form-control" data-rule="required" data-query-name="row[job_category_id]" data-url="xilujob/job_category/job_category">
                    <option value="{$category_ids[1]}" selected></option>
                </select>
                <select class="category3 form-control" data-rule="required" name="row[job_category_id]" data-query-name="row[job_category_id]" data-url="xilujob/job_category/job_category">
                    <option value="{$category_ids[2]}" selected></option>
                </select>
                <span id="category_error"></span>
            </div>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">薪资结算方式:</label>
        <div class="col-xs-12 col-sm-8">
            <select id="c-salary_type" title="请选择" data-rule="required" class="form-control selectpicker" name="row[salary_type]">
                <option value="0" >面议</option>
                <option value="3"  >月薪</option>
                <option value="2" >日薪</option>
                <option value="1" >时薪</option>
            </select>
        </div>
    </div>
    <div id="salary-inputs" class="form-group hide" >
    <label class="control-label col-xs-12 col-sm-2">薪资范围(元):</label>
    <div class="col-xs-5 col-sm-3">
        <input id="c-salary_min" data-rule="required(salaryInput);integer(+);" data-target="#salary-error" class="form-control" name="row[salary_min]" type="text" value="">
    </div>
    <div class="col-xs-2 col-sm-2">
        <p class="form-control-static" style="text-align: center;">——</p>
    </div>
    <div class="col-xs-5 col-sm-3">
        <input id="c-salary_max" data-rule="integer(+);salary_max" data-target="#salary-error" placeholder="不设上限请留空" class="form-control" name="row[salary_max]" type="text" value="">
    </div>
    <div id="salary-error"></div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">职位描述:</label>
        <div class="col-xs-12 col-sm-8">
            <textarea id="c-responsibility" data-rule="required;length(1~500)" maxlength="500" class="form-control" rows="5" name="row[responsibility]" cols="50"></textarea>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">工作环境照片:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-environment_images" data-rule="" class="form-control" size="50" name="row[environment_images]" type="text" value="">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="plupload-environment_images" class="btn btn-danger plupload" data-input-id="c-environment_images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="true" data-preview-id="p-thumb_image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                    <span><button type="button" id="fachoose-environment_images" class="btn btn-primary fachoose" data-input-id="c-environment_images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                </div>
                <span class="msg-box n-right" for="c-thumb_image"></span>
            </div>
            <ul class="row list-inline plupload-preview" id="p-thumb_image"></ul>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">类型:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="checkbox">
                <label for="row[in_hurry]"><input id="row[in_hurry]"  name="row[in_hurry]" type="checkbox" value="1"> 急招</label>
                <label for="row[brand]"><input id="row[brand]" name="row[brand]" type="checkbox" value="1"> 名企大厂</label>
<!--                <label for="row[red_packet]"><input id="row[red_packet]" name="row[red_packet]" type="text" value=""> 红包招聘</label>-->
            </div>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">红包招聘</label>
        <div class="co-xs-12 col-sm-8">
            <input id="c-red_packet" placeholder="" class="form-control" name="row[red_packet]" type="text" value="">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">补贴说明</label>
        <div class="co-xs-12 col-sm-8">
            <textarea maxlength="200" id="c-red_packet_instruction" data-multiple="true" class="form-control" name="row[red_packet_instruction]" type="text" rows="5"></textarea>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">企业福利</label>
        <div class="co-xs-12 col-sm-8">
            <input id="c-benefit_ids" data-source="xilujob/benefit/index" data-multiple="true" class="form-control selectpage" name="row[benefit_ids]" type="text" value="">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">学历要求:</label>
        <div class="col-xs-12 col-sm-8">
            <select id="c-education_level_id" title="请选择" data-rule="required" class="form-control selectpicker" name="row[education_level_id]">
                {foreach name="education_levels" item="vo" key="index"}
                <option value="{$vo.id}" >{$vo.name}</option>
                {/foreach}
            </select>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">工作年限:</label>
        <div class="col-xs-12 col-sm-8">
            <select id="c-work_experience_id" title="请选择" data-rule="required" class="form-control selectpicker" name="row[work_experience_id]">
                {foreach name="work_experience_options" item="vo" key="index"}
                <option value="{$vo.id}" >{$vo.name}</option>
                {/foreach}
            </select>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">工作地点</label>
        <div class="col-xs-12 col-sm-8">
            <div>
                <button id="add-location" type="button" class="btn btn-default btn-embossed">添加工作地点</button>
                <span id="location-error"></span>
            </div>
            <div id="locations">
<!--                <label class="addr-box" for="addr">-->
<!--                    <input type="radio" name="addr" >-->
<!--                    <div class="addr">-->
<!--                        <p>地址地址地址地址地址地址地</p>-->
<!--                        <p>地址地址地址地址地址地址地</p>-->
<!--                    </div>-->
<!--                </label>-->
            </div>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">联系人:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-contact_person" data-rule="required;length(1~20)" class="form-control" name="row[contact_person]" type="text" value="">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">联系电话:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-contact_phone" data-rule="required;length(1~20)" class="form-control" name="row[contact_phone]" type="text" value="">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">联系邮箱:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-contact_email" data-rule="email;length(1~40)" class="form-control" name="row[contact_email]" type="text" value="">
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">状态:</label>
        <div class="col-xs-12 col-sm-8">
            {:build_radios('row[status]',[0=>'下架',1=>'上架'], 1)}
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">置顶排序:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-top" data-rule="integer;range(~999999999)" class="form-control" name="row[top]" type="text" value="0">
        </div>
    </div>

    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>
<script>
    window.editor_items = [
        'justifyleft', 'justifycenter', 'justifyright', 'justifyfull',
        'fontsize', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
    ];
</script>

<script type="text/html" id="location-template">
    <div class="location">
        <input type="hidden" name="row[locations][][id]" value="" />
        <div class="form-control-static">
            <div class="form-inline" data-toggle="cxselect" data-selects="province,city,district">
                地区: <select class="province form-control" data-rule="required" data-target="#location-error"  name="row[locations][][province_id]" data-query-name="pid" data-url="xilujob/job/area">
            </select>
                <select class="city form-control" data-rule="required" data-target="#location-error" name="row[locations][][city_id]" data-query-name="pid" data-url="xilujob/job/area">
                </select>
                <select class="district form-control" data-rule="required" data-target="#location-error" name="row[locations][][district_id]" data-query-name="pid" data-url="xilujob/job/area">
                </select>
                <button type="button" class="btn btn-danger del-location">删除</button>
            </div>
        </div>
        <div class="form-control-static">
            <input type="text" class="form-control" placeholder="填写详细地址" maxlength="40" data-rule="required" data-target="#location-error" name="row[locations][][address]" />
        </div>
    </div>
</script>